package com.burgess.net.queue;

import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
import org.springframework.context.ApplicationContext;
import org.springframework.jms.core.MessageCreator;

import javax.jms.*;

/**
 * 使用队列发送消息
 * 创建人    BurgessLee
 * 创建时间   2020/5/21
 * 描述
 */
public class Sender {

    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        QueueSender queueSender = (QueueSender)applicationContext.getBean("queueSender");
        MessageCreator messageCreator = new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                TextMessage msg = session.createTextMessage("spring msg ---");
                return msg;
            }
        };
//        queueSender.send(messageCreator);
    }

}
